import {RESOURCE_DELETE, RESOURCE_DETAIL, RESOURCE_LIST, RESOURCE_SAVE, RESOURCE_UPDATE, USER_APP_LIST,ROLE_LIST
,ROLE_SAVE,ROLE_UPDATE,ROLE_DELETE,ROLE_ENABLE,ROLE_SORT,queryRoleUserList,queryList,queryListPageZjjg
,queryOrgTree,zzjgSave,zzjgEnable,gwQueryListPage,gwSave,gwShield,gwDelete,gwUpdate,QXsaveRoleUser
,yhQuertPage,yhSave,yhUpdate,queryRoleListByUserAccId,passwordReset,roleList,savesUserRoleList,queryListYh,
deleteRoleUser,zzjgBj,usertoEdit,managementDisabling,queryListForOrgs

} from "./api";
import {METHOD, request} from "../utils/request";

export async function getUserAppList() {
    return request(USER_APP_LIST, METHOD.GET)
}

/**
 *
 * @returns {Promise<AxiosResponse<T>>}
 */
export async function getResourceList(params) {
    return request(RESOURCE_LIST, METHOD.GET, params)
}

export async function resourceSave(data) {
    return request(RESOURCE_SAVE, METHOD.POST, data)
}

export async function getResource(id) {
    return request(RESOURCE_DETAIL+id, METHOD.GET)
}

export async function resourceUpdate(id, data) {
    return request(RESOURCE_UPDATE+ id, METHOD.POST, data)
}

export async function resourceDelete(id) {
    return request(RESOURCE_DELETE+ id, METHOD.POST)
}

export async function getRoleList(params) {
    return request(ROLE_LIST, METHOD.GET, params)
}

export async function roleSave(data) {
    return request(ROLE_SAVE, METHOD.POST, data)
}



export async function roleUpdate(id, data) {
    return request(ROLE_UPDATE+ id, METHOD.POST, data)
}
export async function roleDelete(id) {
    return request(ROLE_DELETE+ id, METHOD.POST)
}

export async function roleEnable(id,shieldVaule) {
    return request(ROLE_ENABLE+ id+'/'+shieldVaule, METHOD.POST)
}

export async function roleSort(id,sortValue) {
    return request(ROLE_SORT+ id+'/'+sortValue, METHOD.POST)
}


export async function queryRoleUserListA(id,data) {
    return request(queryRoleUserList+ id, METHOD.GET,data)
}

export async function queryRoleUserListB(id,data) {
    return request(queryListYh+ id, METHOD.GET,data)
}


export async function queryListA(data) {
    return request(queryList, METHOD.GET,data)
}

export async function queryListTreeA(data) {
    return request('/agri/api/common/roleRes/queryListTree', METHOD.GET,data)
}

export async function queryListTreeB(data) {
    return request('/agri/api/common/roleRes/queryLastStageSelectList', METHOD.GET,data)
}

export async function queryListPageZjjgA(data) {
    return request(queryListPageZjjg, METHOD.GET,data)
}

export async function queryOrgTreeA(data) {
    return request(queryOrgTree, METHOD.GET,data)
}


export async function zzjgSaveA(data) {
    return request(zzjgSave, METHOD.POST, data)
}
export async function zzjgEnableA(id,shieldVaule) {
    return request(zzjgEnable+ id+'/'+shieldVaule, METHOD.POST)
}

export async function gwQueryListPageA(data) {
    return request(gwQueryListPage, METHOD.GET,data)
}

export async function gwSaveA(data) {
    return request(gwSave, METHOD.POST, data)
}

export async function gwDeleteA(id) {
    return request( gwDelete+ id, METHOD.POST)
}

export async function gwShieldA(id,shieldVaule) {
    return request(gwShield+ id+'/'+shieldVaule, METHOD.POST)
}
export async function disableBtn(id,tenantCode,subjectInfoId,shieldVaule) {
    return request(managementDisabling+ id+'/'+tenantCode+'/'+subjectInfoId+'/'+shieldVaule, METHOD.POST)
}

export async function yhSaveA(data) {
    return request(yhSave, METHOD.POST, data)
}

export async function yhUpdateA(id, data) {
    return request(yhUpdate+ id, METHOD.POST, data)
}




export async function yhQuertPageA(params) {
return request(yhQuertPage, METHOD.GET, params)
}
export async function gwUpdateA(id, data) {
    return request(gwUpdate+ id, METHOD.POST, data)
}

export async function QXsaveRoleUserA(id, data) {
    return request(QXsaveRoleUser+ id, METHOD.POST, data)
}
/**
 * 密码重置
**/
export async function resetPassword(id) {
    return request(passwordReset+ id, METHOD.POST)
}
/**
 * 获取用户已选择和未选择角色列表
**/
export async function selectRoleList(id,shieldVaule) {
    return request(roleList+ id +'/'+shieldVaule, METHOD.POST)
}
/**
 * 保存用户角色列表
**/
export async function savesRoleList(data) {
    return request(savesUserRoleList, METHOD.POST,data)
}
export async function queryRoleListByUserAccIdA(id, tenantCode) {
    return request(queryRoleListByUserAccId+ id+"/"+tenantCode, METHOD.POST)
}
/**
 * 权限分配页面保存按钮
 */
export async function saveRoleListByRoleId(data) {
    return request('/agri/api/common/roleRes/saveRoleResourceForAllResourceList', METHOD.POST,data)
}
/**
 * 用户编辑
 */
export async function editEnteringData(id,data) {
    return request(usertoEdit+ id, METHOD.POST,data)
}

/**
 *
**/
export async function deleteRoleUserAS(id,data) {
    return request(deleteRoleUser+id, METHOD.POST,data)
}


/**
 *
**/
export async function zzjgBjHandle(id,data) {
    return request(zzjgBj+id, METHOD.POST,data)
}

export async function queryListForOrgsAA(data) {
    return request(queryListForOrgs, METHOD.GET,data)
}








